﻿using Ebusiness_OrderService.Services;
using Ebusiness_OrderService.Services.Dtos.Order;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.DependencyInjection;

namespace Ebusiness_Gateway.Controllers
{
    [Route("Order/[action]")]
    [ApiController]
    public class OrderController : AbpController, IOrderService
    {
        public IOrderService orderService { get; set; }

        public OrderController()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<OrderDto> CreateAsync(OrderDto input)
        {
            return await orderService.CreateAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task DeleteAsync(Guid id)
        {
            await orderService.DeleteAsync(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<OrderDto> GetAsync(Guid id)
        {
            return await orderService.GetAsync(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagedResultDto<OrderDto>> GetListAsync(PagedAndSortedResultRequestDto input)
        {
            return await orderService.GetListAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<OrderDto> UpdateAsync(Guid id, OrderDto input)
        {
            return await orderService.UpdateAsync(id, input);
        }

        /// <summary>
        /// 自定义方法测试
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<string> Custome()
        {
            return Task.FromResult("1233");
        }
    }

    //[Dependency(ServiceLifetime.Transient)]
    //public class OrderService : IOrderService, IRemoteService
    //{
    //    public Task<OrderDto> CreateAsync(OrderDto input)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public Task<string> Custome()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public Task DeleteAsync(Guid id)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public Task<OrderDto> GetAsync(Guid id)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public Task<PagedResultDto<OrderDto>> GetListAsync(PagedAndSortedResultRequestDto input)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public Task<OrderDto> UpdateAsync(Guid id, OrderDto input)
    //    {
    //        throw new NotImplementedException();
    //    }
    //}
}
